import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        Properties props = new Properties();
        //2、调用Properties的load方法读取文件
        try {
            props.load(new FileReader("user.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        String s = "";
        //测试打印
        Set<Object> set = props.keySet();
        for (Object obj : set) {
            String key = (String) obj;
            String value = props.getProperty(key);
            s += value + ";";
        }
        s = s.substring(0, s.length() - 1);
        System.out.println(s);
        String[] str = s.split("[;]");
        System.out.println(str.length);
    }
}
